<?php
/**
* @package djtpl
* @author J.Ducastel <nospam0@ducastel.name>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/

/**
* templates storage for kits
* @uses djtplTemplate
*/
class DjtplStorage extends WakStorage {

    function toolFactory($kit_id,$cfg=array()) {
        return new DjtplStorage($kit_id,$cfg);
    }

    function get($id) {
        $file=$this->getPath().$this->_makeFileName($id);
        if (!file_exists($file))
            return false;
        $content=file_get_contents($file);
        $tpl=new DjTplTemplate($content);
        $tpl->setStorage($this);
        return $tpl;
    }

    /**
    * @var array default conf
    */
    var $default_cfg=array(
        'storage'=>array(
            'filenames'=>'templates/{{lang}/}{{id}}.djtpl.html'
            ,'class'=>'DjtplTemplate')
        ,'criteria'=>array());

}
